 

*For Margaret dropbox folders 
global NCREIF "/Users/BeckaBrolinson/Dropbox/NCREIF/data" 
global build 	"$NCREIF/build" 
global analysis "$NCREIF/analysis"
global results 	"$analysis/results"
global figures 	"$analysis/figures" 


*------------------------------------------------------------------------------*
*	Step 6- Matching Constructing Matched Data Sets	   *
*------------------------------------------------------------------------------*	


	use "$build/01_annualizeddatawcontrol.dta", replace
	keep 	year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	
	drop if missing(year) 
	
	*generate means of these time-invariant variables 
	#d ; 
	local timeinvariant "nooffloors noofunits noofbuildings nra sqft yrbuilt
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude"; 
	#d cr 

	sort propnum
	foreach var of local timeinvariant{
	by propnum: egen mean_`var'= mean(`var') 
	*Count for how many properties the mean and the observations are not equivalent 
	di "`var'
	count if mean_`var'!=`var'
	} 

	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch2", replace 
	
	
	*Generate dataset without years where at least one observation was missing 
	*and we imputed the value 
	use "$build/01_annualizeddatawcontrol.dta", replace
	drop if fake_data == 1 
	keep 	year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	
	drop if missing(year) 
	
	*generate means of these time-invariant variables 
	#d ; 
	local timeinvariant "nooffloors noofunits noofbuildings nra sqft yrbuilt
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude"; 
	#d cr 

	sort propnum
	foreach var of local timeinvariant{
	by propnum: egen mean_`var'= mean(`var') 
	*Count for how many properties the mean and the observations are not equivalent 
	di "`var'
	count if mean_`var'!=`var'
	} 

	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch_withoutimputations", replace 
	
*Import the data into R and run matching there, and then import the results 	
	
import delimited "/Users/BeckaBrolinson/Dropbox/2019/NCREIF/programs/R/2018_3_29_maha_match_timeinvar_cal.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	keep if _merge==3 
	
	/*
	*Generate real values for capital expenditures 
	gen CPI = . //source for CPI https://www.minneapolisfed.org/community/financial-and-economic-education/cpi-calculator-information/consumer-price-index-and-inflation-rates-1913
	replace CPI = 172.2 if year==2000 
	replace CPI = 177.1 if year==2001 
	replace CPI = 179.9 if year==2002 
	replace CPI = 184.0 if year==2003
	replace CPI = 188.9 if year==2004 
	replace CPI = 195.3 if year==2005 
	replace CPI = 201.6 if year==2006 
	replace CPI = 207.3 if year==2007 
	replace CPI = 215.3 if year==2008 
	replace CPI = 214.5 if year==2009 
	replace CPI = 218.1 if year==2010 
	replace CPI = 224.9 if year==2011 
	replace CPI = 229.6 if year==2012 
	replace CPI = 223.0 if year==2013 
	replace CPI = 236.7 if year==2014 
	replace CPI = 237.0 if year==2015 
	
	foreach x in capex_ti capex_bldimp{
	gen real_`x' = `x' * (172.2 / CPI)
	}
	*/
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch2.dta", replace
	
	
import delimited "$build/2021_6_29_maha_match_timeinvar_cal.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	keep if _merge==3 	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch2_wmatches.dta", replace

	drop _merge 
	merge 1:1 propnum year using "/Users/BeckaBrolinson/Dropbox/2019/NCREIF/data/build/FakeNCREIFAnnualizedDatawcontrol_PostMatch2.dta", gen(compare)
************* 
*Test matching only on time-invariant and the mean of time-varying characterisitcs 

	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	
	*keep if post==0 | treat==0 & year<=2009 
	
	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 
	#d ; 
	
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6"; 
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch3", replace 
	
*Import the data into R and run matching there, and then import the results 	
	
	
import delimited "/Users/BeckaBrolinson/Dropbox/2019/NCREIF/programs/R/2019_3_21_maha_match_MeanVar_cal.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta" clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch3.dta", replace

	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_13_maha_match_MeanVar_cal.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch3_wmatches.dta", replace
	
*Test matching on time-invariant and the mean of time-varying characterisitcs both 
	*Basically the combination of the previous two 

	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	

	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 
			
	
	#d ; 
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6
				nooffloors noofunits noofbuildings nra lastrenovatedyear
				yrbuiltorlastren  latitude longitude"; 
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch4", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal4.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch4_wmatches.dta", replace
	
	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	

	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 
			
	
	#d ; 
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6
				nooffloors noofunits noofbuildings nra lastrenovatedyear
				yrbuiltorlastren  latitude longitude"; 
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch4", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal4.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch4_wmatches.dta", replace
	
****Time invariant match but on averages based on "pre-treatment characteristics"
	
	use "$build/01_annualizeddatawcontrol.dta", replace
	keep 	year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat post
	drop if missing(year) 
	
		
	*Generate post year as 2009 for the untreated buildings 
	replace post = 1 if year >=2009 & treat == 0 
	
	*only keep buildings precertification 
	keep if post == 0 
	
	
	*generate means of these time-invariant variables 
	#d ; 
	local timeinvariant "nooffloors noofunits noofbuildings nra sqft yrbuilt
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude"; 
	#d cr 

	sort propnum
	foreach var of local timeinvariant{
	by propnum: egen mean_`var'= mean(`var') 
	*Count for how many properties the mean and the observations are not equivalent 
	di "`var'
	count if mean_`var'!=`var'
	} 

	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch5", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal5.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch5_wmatches.dta", replace
	
**Now with 2008 as the year 
	use "$build/01_annualizeddatawcontrol.dta", replace
	keep 	year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat post
	drop if missing(year) 
	
		
	*Generate post year as 2009 for the untreated buildings 
	replace post = 1 if year >=2008 & treat == 0 
	
	*only keep buildings precertification 
	keep if post == 0 
	
	
	*generate means of these time-invariant variables 
	#d ; 
	local timeinvariant "nooffloors noofunits noofbuildings nra sqft yrbuilt
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude"; 
	#d cr 

	sort propnum
	foreach var of local timeinvariant{
	by propnum: egen mean_`var'= mean(`var') 
	*Count for how many properties the mean and the observations are not equivalent 
	di "`var'
	count if mean_`var'!=`var'
	} 

	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch6", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal6.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch6_wmatches.dta", replace
	

	*With time-varying and time-inariant for pre-period only 
	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	

	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 post
	
	*Generate post year as 2009 for the untreated buildings 
	replace post = 1 if year >=2009 & treat == 0 
	
	*only keep buildings precertification 
	keep if post == 0 
				
	
	#d ; 
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6"
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch7", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal7.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch7_wmatches.dta", replace	
	
	
	
	*With time-varying and time-inariant for pre-period only 
	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	

	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 post
	
	*Generate post year as 2009 for the untreated buildings 
	replace post = 1 if year >=2009 & treat == 0 
	
	*only keep buildings precertification 
	keep if post == 0 
				
	
	#d ; 
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6
				nooffloors noofunits noofbuildings nra lastrenovatedyear
				yrbuiltorlastren  latitude longitude"; 
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch8", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal8.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch8_wmatches.dta", replace	
	
	
	
*Same as 7 but with 2008 data 

	*With time-varying and time-inariant for pre-period only 
	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	

	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 post
	
	*Generate post year as 2009 for the untreated buildings 
	replace post = 1 if year >=2008 & treat == 0 
	
	*only keep buildings precertification 
	keep if post == 0 
				
	
	#d ; 
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6"
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch9", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal9.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch9_wmatches.dta", replace	
	
*Same as 8 but with 2008 data 
*With time-varying and time-inariant for pre-period only 
	use "$build/01_annualizeddatawcontrol.dta", clear
	drop if missing(year) 
	drop if missing(yrbuilt) 
	

	keep year propnum nooffloors noofunits noofbuildings nra sqft yrbuilt ///
	lastrenovatedyear yrbuiltorlastren Covered_E latitude longitude	treat	///
					rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E ///
				real_elecprice real_gasprice Unemployment HDD CDD age used_space ///
				percentleased real_capex_ti real_capex_bldimp dFundType1 ///
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6 post
	
	*Generate post year as 2009 for the untreated buildings 
	replace post = 1 if year >=2008 & treat == 0 
	
	*only keep buildings precertification 
	keep if post == 0 
				
	
	#d ; 
	global vars "rl_yr_utilpersf rl_yr_rentpersf sqft yrbuilt Covered_E 
				real_elecprice real_gasprice Unemployment HDD CDD age used_space
				percentleased real_capex_ti real_capex_bldimp dFundType1
				dFundType2 dFundType3 dFundType4 dFundType5 dFundType6
				nooffloors noofunits noofbuildings nra lastrenovatedyear
				yrbuiltorlastren  latitude longitude"; 
	#d cr 
	
	foreach var	of global vars{
	bysort propnum: egen mean_`var' = mean(`var') 
	} 
	
	bysort propnum: gen id_unique=_n==1
	keep if id_unique==1 
	
	save "$build/NCREIF_CleanedForMatch10", replace 
	
	
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal10.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch10_wmatches.dta", replace	
	
	
	
	**Now for altnerative matching proceedures based on our main dataset 
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal11.csv", delimiter(";") clear
	*Take the data from long back to wide 
	*Matching with replacement 
	drop weight 
	bysort propnum: gen propcount = _n 
	gen one =1 
	bysort propnum: egen weight = total(one)
	keep propnum weight matchcalindexcontrol matchcalindextreat
	bysort propnum: gen id_unique = _n ==1 
	keep if id_unique ==1 
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch11_wmatches.dta", replace	
	
	**Now for altnerative matching proceedures based on our main dataset 
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal11.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch11_wmatches.dta", replace	
	
	
		**Now for altnerative matching proceedures based on our main dataset 
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal12.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch12_wmatches.dta", replace	

	**Now for altnerative matching proceedures based on our main dataset 
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal13.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch13_wmatches.dta", replace	
	
	**Now for altnerative matching proceedures based on our main dataset 
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal14.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch14_wmatches.dta", replace	
	
		**Now for altnerative matching proceedures based on our main dataset 
	import delimited "/Users/BeckaBrolinson/Dropbox/NCREIF/data/build/2021_7_14_maha_match_MeanVar_cal15.csv", delimiter(";") clear
	*Take the data from long back to wide 
	keep propnum weight matchcalindexcontrol matchcalindextreat
	tempfile PropnumWeights
	save "`PropnumWeights'" 
*Merge the weight data back into the data 
	use "$build/01_annualizeddatawcontrol.dta", clear
	merge m:1 propnum using "`PropnumWeights'" 
	
	keep if _merge==3 
	
	save "$build/FakeNCREIFAnnualizedDatawcontrol_PostMatch15_wmatches.dta", replace	
